<!-- Search by Category start -->
<div class="article2">
    <?php $this->load->view("topsearch"); ?>
</div><!-- Search by Category end -->

<!-- Page Navigation start-->
<div id="page-navi"><a href="<?php echo base_url(); ?>division/info/<?php echo $division_id; ?>">Division name</a>&rarr; <?php echo $branch_info->branchname; ?></div>
<!-- Page Navigation end-->

<h2><?php echo $branch_info->branchname; ?></h2>

<!-- #featured section start -->
<div id="featured">
    <div>
        <h3 style="margin-bottom:12px;">General information & Population Statistics</h3>
        <p><img src="<?php echo base_url(); ?>images/gampola-map.png" width="190" class="left-align" style="border:5px solid #868593;" alt=""/> <?php echo $branch_info->branchdsc ; ?>
    </div>


</div><!-- #featured section end -->

<!-- .article section Start -->
<div class="article">

<!-- Race / Religion / Gender / Age  Start	-->
<div class="news">
    <!-- Race Section start -->
    <div id="searchresult" style="display: none;"></div>
    <div id="defaultresult">
    <div class="section-01 st">
        <h4>Race [ජන වර්ගය] :</h4>
        <table id="hor-minimalist-b" summary="">
            <thead>
            <tr>
                <th width="185" scope="col">Category</th>
                <th width="93" scope="col">Amount</th>
            </tr>
            </thead>
            <tbody>
            <?php
            foreach ($branch_arr as $_data) :
                if($_data['populationcatdesc'] == "sinhalese")
                    $sinhalese .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "srilankan_tamil")
                    $srilankan_tamil .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "indian_tamil")
                    $indian_tamil .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "muslim")
                    $muslim .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "other_nat")
                    $other_nat .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "buddhist")
                    $buddhist .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "catholic")
                    $catholic .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "islam")
                    $islam .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "hindu")
                    $hindu .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "other_rel")
                    $other_rel .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "male")
                    $male .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "female")
                    $female .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "age_1_16")
                    $age_1_16 .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "age_16_30")
                    $age_16_30 .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "age_30_50")
                    $age_30_50 .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "age_50")
                    $age_50 .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "votees")
                    $votees .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "area")
                    $area .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "population")
                    $population .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "house_units")
                    $house_units .= $_data['TOTALCOUNT'];
                if($_data['populationcatdesc'] == "samurdi_families")
                    $samurdi_families .= $_data['TOTALCOUNT'];


            endforeach;
            ?>

            <tr>
                <td>Sinhalese</td>
                <td><?php echo $sinhalese; ?></td>
            </tr>
            <tr>
                <td>Sri Lankan Tamil</td>
                <td><?php echo $srilankan_tamil; ?></td>
            </tr>
            <tr>
                <td>Indian Tamil</td>
                <td><?php echo $indian_tamil; ?></td>
            </tr>
            <tr>
                <td>Muslim</td>
                <td><?php echo $muslim; ?></td>
            </tr>
            <tr>
                <td>Other</td>
                <td><?php echo $other_nat; ?></td>
            </tr>
            <tr>
                <td class="td-style01" style="border-bottom:none;" >Total</td>
                <td class="td-style01" style="border-bottom:none;" >
                    <?php
                    $total_nat = $sinhalese + $srilankan_tamil + $indian_tamil + $muslim + $other_nat;
                    echo $total_nat; // do not delete
                    ?>
                </td>
            </tr>
            </tbody>
        </table>
    </div><!-- Race Section end -->


    <!-- Religion Section start -->
    <div class="section-01">
        <h4>Religion [ආගම] :</h4>
        <table id="hor-minimalist-b" summary="">
            <thead>
            <tr>
                <th width="185" scope="col">Category</th>
                <th width="93" scope="col">Amount</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Buddhist</td>
                <td><?php echo $buddhist; ?></td>
            </tr>
            <tr>
                <td>Catholic</td>
                <td><?php echo $catholic; ?></td>
            </tr>
            <tr>
                <td>Hindu</td>
                <td><?php echo $hindu; ?></td>
            </tr>
            <tr>
                <td>Islam</td>
                <td><?php echo $islam; ?></td>
            </tr>
            <tr>
                <td>Other</td>
                <td><?php echo $other_rel; ?></td>
            </tr>
            <tr>
                <td class="td-style01" style="border-bottom:none;" >Total</td>
                <td class="td-style01" style="border-bottom:none;" >
                    <?php
                    $total_rel = $buddhist + $catholic + $hindu + $islam + $other_rel;
                    echo $total_rel; // do not delete
                    ?>
                </td>
            </tr>
            </tbody>
        </table>
    </div><!-- Religion Section end -->

    <!-- Gender Section start -->
    <div class="section-01 st">
        <h4>Gender [ස්ත්‍රී/පුරුෂ] :</h4>
        <table id="hor-minimalist-b" summary="">
            <thead>
            <tr>
                <th width="185" scope="col">Category</th>
                <th width="93" scope="col">Amount</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Male</td>
                <td><?php echo $male; ?></td>
            </tr>
            <tr>
                <td>Female</td>
                <td><?php echo $female; ?></td>
            </tr>
            <tr>
                <td class="td-style01" style="border-bottom:none;" >Total</td>
                <td class="td-style01" style="border-bottom:none;" >
                    <?php
                    $total_gen = $male + $female;
                    echo $total_gen; // do not delete
                    ?>
                </td>
            </tr>
            </tbody>
        </table>
    </div><!-- Gender Section end -->

    <!-- Age Section start -->
    <div class="section-01">
        <h4>Age [වයස] :</h4>
        <table id="hor-minimalist-b" summary="">
            <thead>
            <tr>
                <th width="185" scope="col">Category</th>
                <th width="93" scope="col">Amount</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>1-16</td>
                <td><?php echo $age_1_16; ?></td>
            </tr>
            <tr>
                <td>16-30</td>
                <td><?php echo $age_16_30; ?></td>
            </tr>
            <tr>
                <td>30-50</td>
                <td><?php echo $age_30_50; ?></td>
            </tr>
            <tr>
                <td>50 above</td>
                <td><?php echo $age_50; ?></td>
            </tr>
            <tr>
                <td class="td-style01" style="border-bottom:none;" >Total</td>
                <td class="td-style01" style="border-bottom:none;" >
                    <?php
                    $total_age = $age_1_16 + $age_16_30 + $age_30_50 + $age_50;
                    echo $total_age;
                    ?>
                </td>
            </tr>
            </tbody>
        </table>
    </div><!-- Age Section end -->
    <!-- Votees Section start -->
    <div class="section-01" style="width:600px;">
        <h4>Other Info :</h4>
        <table id="hor-minimalist-b" summary="" style="width: 600px !important;">
            <thead>
            <tr>
                <th width="400" scope="col">Category</th>
                <th width="200" scope="col">Amount</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Votees [ආසන්න ඡන්ද සංඛ්‍යාව]</td>
                <td><?php echo ($votees != "")?$votees:"-"; ?></td>
            </tr>
            <tr>
                <td>Area [භූමි ප්‍රමාණය]</td>
                <td><?php echo ($area != "")?$area:"-"; ?></td>
            </tr>
            <tr>
                <td>Population [ජන ඝනත්වය]</td>
                <td><?php echo ($population != "")?$population:"-"; ?></td>
            </tr>
            <tr>
                <td>House Units [නිවාස ඒකක ගණන]</td>
                <td><?php echo ($house_units != "")?$house_units:"-"; ?></td>
            </tr>
            <tr>
                <td>Samurdhi Beneficiaries [සමෘධි පවුල් සංඛ්‍යාව]</td>
                <td><?php echo ($samurdi_families != "")?$samurdi_families:"-"; ?></td>
            </tr>
            </tbody>
        </table>
    </div><!-- Votees Section end -->
    </div>


</div><!-- Race / Religion / Gender / Age  End	-->
<?php if($branch_info->activity != "") : ?>
<div class="news">
    <div style="width:600px;" class="section-01">
        <h4>Other Activities :</h4>
        <?php echo $branch_info->activity; ?>
    </div>
</div>
<?php endif; ?>
<?php
for($i=0; $i<count($population_arr); $i++){
	if($population_arr[$i]['populationcatdesc'] == "buddhist")
	$buddhist = $population_arr[$i]['TOTALCOUNT'];
	if($population_arr[$i]['populationcatdesc'] == "catholic")
	$catholic = $population_arr[$i]['TOTALCOUNT'];
	if($population_arr[$i]['populationcatdesc'] == "islam")
	$islam = $population_arr[$i]['TOTALCOUNT'];
	if($population_arr[$i]['populationcatdesc'] == "hindu")
	$hindu = $population_arr[$i]['TOTALCOUNT'];
	if($population_arr[$i]['populationcatdesc'] == "other_rel")
	$other_rel = $population_arr[$i]['TOTALCOUNT'];	
	if($population_arr['populationcatdesc'] == "sinhalese")
	$sinhalese = $population_arr['TOTALCOUNT'];
	if($population_arr['populationcatdesc'] == "srilankan_tamil")
	$srilankan_tamil = $population_arra['TOTALCOUNT'];
	if($population_arr['populationcatdesc'] == "indian_tamil")
	$indian_tamil = $population_arra['TOTALCOUNT'];
	if($population_arra['populationcatdesc'] == "muslim")
	$muslim = $population_arr['TOTALCOUNT'];
	if($population_arr['populationcatdesc'] == "other_nat")
	$other_nat = $population_arr['TOTALCOUNT'];				
}
?>
<script type="text/javascript">
			google.load("visualization", "1", {packages:["corechart"]});
			google.setOnLoadCallback(drawChart);
			function drawChart() {			

				var data = new google.visualization.DataTable();
				    data.addColumn('string', 'Religion');
				    data.addColumn('number', 'Stats');
				    data.addRows([
				      ['Buddhist',<?php echo $buddhist; ?>],
				      ['Catholic',<?php echo $catholic; ?>],
				      ['Islam',<?php echo $islam; ?>],
				      ['Hindu',<?php echo $hindu; ?>],
				      ['Other',<?php echo $other_rel; ?>],
				    ]);

			
				var options = {
				  title: 'Religion [ආගම]',
				  legend: 'none',
				  colors: ['blue']			
				};



				var chart = new google.visualization.ColumnChart(document.getElementById('chart_religion'));
				chart.draw(data, options);
			}
		</script>

		<script type="text/javascript">
			google.load("visualization", "1.0", {packages:["corechart"]});
			google.setOnLoadCallback(drawChart);
			function drawChart() {
				var data = new google.visualization.DataTable();
				data.addColumn('string', 'Race');
				data.addColumn('number', 'Stats');
				data.addRows([
					['Sinhalese',<?php echo $sinhalese; ?>],
					['Sri Lankan Tamil',<?php echo $srilankan_tamil; ?>],
					['Indian Tamil',<?php echo $indian_tamil; ?>],
					['Muslim',<?php echo $muslim; ?>],
					['Other',<?php echo $other_nat; ?>],
				]);
			
			
				//var formatter = new google.visualization.BarFormat({width: 20});
  				//formatter.format(data, 1); // Apply formatter to second column

				var options = {
					title: 'Race [ජන වර්ගය]',
					legend: 'none',
			  		colors: ['green']
				};

				var chart1 = new google.visualization.ColumnChart(document.getElementById('chart_race'));
				chart1.draw(data, options);
			}
		</script>
<div class="section odd">
<div>
<!-- Branch Organizations Tabs Start -->
<h2>Statistics</h2>
<!-- Category section Start -->
<div id="chart_religion" class="stat_charts" style="width: 600px; height: 350px;"></div>
<div id="chart_race" class="stat_charts" style="width: 600px; height: 350px;"></div>
<!-- Branch Organizations Tabs End -->


</div>
</div>

<!-- Bottom Navigation Root Start -->
<!--<div id="btm-navi">
    <a href="#">Division name</a>&rarr; <a href="#">Region name</a>&rarr; <a href="#">Branch name</a>
</div>--><!-- Bottom Navigation Root End -->

</div><!-- .article section End -->
</div><!-- Main Right Section end ------------------------------------------ -->
